#!/bin/bash
#description install php-json

SOFTDIR=/usr/local/src
PHPVERSION=php-7.0.27

#install jsond 

cd ${SOFTDIR}
wget http://pecl.php.net/get/jsond-1.4.0.tgz && tar xf jsond-1.4.0.tgz && cd jsond-1.4.0
/usr/local/${PHPVERSION}/bin/phpize
./configure --with-php-config=/usr/local/${PHPVERSION}/bin/php-config
make install > /tmp/jsond.txt

#add json.so to php.ini file

cd `cat /tmp/jsond.txt |grep "Installing shared"|awk -F: '{print $2}'`
[ -f jsond.so ] && echo "extension=jsond.so" >> /usr/local/${PHPVERSION}/etc/php.ini

# restart php-fpm service
service php-fpm restart

